<template>
  <div>
    <div style="padding: 20px 0 20px 20px">
      <span style="size: 16px">服务/</span>
      <span style="color: #1c84c6; size: 16px">客房动态</span>
    </div>

<!--    ==============表格======================-->
    <div style="margin-left: 20px">
    <!---------              表头 -- 上           -------->
    <div style="display: flex; margin-left: 50px">
      <div class="bigBox-top">
        <p>全部类型</p>
      </div>
      <div class="bigBox-top">
        <p>经济单人间</p>
      </div>
      <div class="bigBox-top">
        <p>情侣大床房</p>
      </div>
      <div class="bigBox-top">
        <p>豪华大床房</p>
      </div>
      <div class="bigBox-top">
        <p>贵族大床房</p>
      </div>
      <div class="bigBox-top">
        <p>商务标准间</p>
      </div>
      <div class="bigBox-top">
        <p>标准三人间</p>
      </div>
      <div class="bigBox-top">
        <p>豪华套房</p>
      </div>
      <div class="bigBox-top">
        <p>总统套房</p>
      </div>

    </div>

    <!---------              表头 -- 右           -------->
    <div style="float: left;margin-left: 0; margin-top: 15px">
      <div class="bigBox-right">
        <p>全部</p>
      </div>
      <div class="bigBox-right">
        <p>二楼</p>
      </div>
      <div class="bigBox-right">
        <p>三楼</p>
      </div>
      <div class="bigBox-right">
        <p>五楼</p>
      </div>
      <div class="bigBox-right">
        <p>六楼</p>
      </div>
    </div>

    <!---------              大BOX           -------->
    <div class="bigBox-Wai">
      <div class="bigBox">
        <!--          净房-->
          <div class="cleanRoom"
               v-for="(room, index) in roomList"
               :key="index"
               :style="{ backgroundColor: room.color}"
               :class="'stu' + room.statusId">
            <div>
<!--              房间号-房型    -->
              <span class="roomType">{{room.rnum}}</span>
              <span class="roomType">{{room.rname}}</span>
            </div>
<!--            房间状态         -->
            <div>
           <span style="margin-left: 20px">{{room.roomStatusList[0].status}}</span>
           </div>
            <div class="icon">
<!--              <i class="el-icon-eleme" style="font-size: 60px"></i>-->
            </div>
<!--            价格-->
            <div style="float: right; margin-right: 10px">
              <span class="roomType">价格: ¥{{room.price}}</span>
            </div>
          </div>
      </div>

    </div>
    </div>
  </div>

</template>

<script>
  import {listRoom, listRoomStatus} from "../../../api/roomDynamics/roomDynamics";
  import { listRoomType } from '../../../api/room/room'

  export default {
    name: 'RoomDynamic',
    data() {
      return {
        total: 20,
        loading: true,
        typeList:[],
        statusList:[],
        queryParams: {
          pageNum: 1,
          pageSize: 45,
          rName: null,
          rNum: null,
          area: null,
          floor: null,
          people: null,
          bednum:null,
          price: null,
          image: null,
          info: null,
          isaddbed: null,
          ismeal: null,
          iswindow: null,
          typeId: null,
          typeName:null,
          statusId: null,
          baselist: null,
          servicelist: null,
          gamelist: null,
          del: null
        },
        roomList: [],
        pageNum: 1,
        room: [{
          rNum: null,
          rName: null,
          price: null,
          color: '#409EFF',
        },
        ]
      }
    },
    created() {
      this.getList();
    },
    methods: {
      getStatusText(status) {
        if (status === '预定') return '预定';
        if (status === '有客') return '有客';
        if (status === '净房') return '净房';
        if (status === '脏房') return '脏房';
        return '';
      },
      getStatusClass(status) {
        if (status === '预定') return 'status-pending';
        if (status === '有客') return 'status-occupied';
        if (status === '净房') return 'status-clean';
        if (status === '脏房') return 'status-dirty';
        return '';
      },
      getList() {
        this.loading = true;
        listRoom(this.queryParams).then(response => {
          this.roomList = response.data.list;
          console.log("------")
          console.log(this.roomList)
          console.log("------")
          this.total = response.data.total;
          this.loading = false;
        });
        listRoomStatus().then(response => {
          console.log(response.data)
          this.statusList=response.data.map(item =>item)
          console.log(this.statusList)
          this.loading = false;
        });
      }
    }
  }
</script>

<style scoped>
  .bigBox-Wai{
    border: solid rgb(187, 187, 187) 1px;
    width: 1380px;
    margin-left: 5px;
    float: left;
  }
  .bigBox{
    width: 100%;
    height: 100%;
    margin: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  /*--------------   房间 ----------------*/
  .cleanRoom{
    width: 150px;
    height: 160px;
    border-radius: 5%;
    border: #5a5e66 solid 1px;
  }
  .roomType{
    /*color: white;*/
    size: 12px;
    margin-left: 20px;
    height: 50px;
    line-height: 50px;

  }
  .icon{
    width: 50px;
    height: 50px;
    margin: auto;
  }
  /*  --------------  表头 - 上 -------------------------*/
  .bigBox-top{
    width: 150px;
    background-color: #409EFF;
    border: rgb(48, 146, 252) solid 1px;
  }
  .bigBox-top p{
    line-height: 15px;
    height: 15px;
    text-align: center;
    color: white;
  }
  /*  --------------  表头 - 右 -------------------------*/
  .bigBox-right{
    height: 160px;
    width: 30px;
    color: white;
    background-color: #409EFF;
    display: flex;
    border: rgb(48, 146, 252) solid 1px;
  }
  .bigBox-right p{
    text-align: center;
    line-height: 20px;
    display: table-cell;
    align-self: center;
  }
  /*   净房   */
  .stu1{
    background-color: #3498DB;
  }
  /*   脏房   */
  .stu2{
    background-color: #5a5e66;
  }
  /*   预定   */
  .stu3{
    background-color: #1ab394;
  }
  /*   有客   */
  .stu4{

    background-color: #E74C3C;
  }




</style>
